<include file='Common:header' />

<!-- /section:basics/navbar.layout -->
<div class="main-container" id="main-container">

	<!-- #section:basics/sidebar -->

	<include file='Common:left' />


	<!-- /section:basics/sidebar -->
	<div class="main-content">
		<div class="main-content-inner">
			<div class="page-content">



				<!--主题-->
				<div class="page-header">
					<h1>
						您当前操作
						<small>
							<i class="ace-icon fa fa-angle-double-right"></i>
							添加栏目
						</small>
					</h1>
				</div>
				<div class="row">
					<div class="col-xs-12">
						<form class="form-horizontal" name="runnews_columnedit" id="runnews_columnedit" method="post" action="{:U('news_column_runedit')}">
							<input type="hidden" name="c_id" value="{$column.c_id}" />
							<input type="hidden" name="column_leftid" value="{$column.column_leftid}" />
							<div class="form-group">
								<label class="col-sm-3 control-label no-padding-right" for="form-field-1"> 栏目名称 </label>
								<div class="col-sm-9">
									<input type="text" name="column_name" id="column_name" value="{$column.column_name}" class="col-xs-10 col-sm-5" />
                                            <span class="help-inline col-xs-12 col-sm-7">
												<span class="middle" id="resone"></span>
											</span>
								</div>
							</div>
							<div class="space-4"></div>

							<div class="form-group">
								<label class="col-sm-3 control-label no-padding-right" for="form-field-1"> 英文栏目名称 </label>
								<div class="col-sm-9">
									<input type="text" name="column_enname" id="column_enname" value="{$column.column_enname}" placeholder="英文栏目名称"  class="col-xs-10 col-sm-5" />
								</div>
							</div>
							<div class="space-4"></div>

							<div class="form-group">
								<label class="col-sm-3 control-label no-padding-right" for="form-field-1"> 栏目类型 </label>
								<div class="col-sm-9">
									<div class="radio">
										<label>
											<input name="column_type" type="radio" class="ace" id="type1" value="1" <if condition="$column.column_type eq 1">checked</if>/>
											<span class="lbl"> 作为频道页，不可作为栏目发布文章</span>
										</label>
									</div>

									<div class="radio">
										<label>
											<input name="column_type" id="type2" type="radio" class="ace" value="2" <if condition="$column.column_type eq 2">checked</if>/>
											<span class="lbl"> 不直接发布内容，用于跳转页面</span>
										</label>
									</div>

									<div class="radio">
										<label>
											<input name="column_type" id="type3" type="radio" class="ace" value="3" <if condition="$column.column_type eq 3">checked</if>/>
											<span class="lbl"> 作为发布栏目，文章列表模式</span>
										</label>
									</div>

									<div class="radio">
										<label>
											<input name="column_type" id="type4" type="radio" class="ace" value="4" <if condition="$column.column_type eq 4">checked</if>/>
											<span class="lbl"> 作为发布栏目，图片列表模式</span>
										</label>
									</div>

									<div class="radio">
										<label>
											<input name="column_type" id="type5" type="radio" class="ace" value="5" <if condition="$column.column_type eq 5">checked</if>/>
											<span class="lbl"> 单页面模式，例如企业简介</span>
										</label>
									</div>
								</div>
							</div>
							<div class="space-4"></div>

							<div class="form-group" id="address">
								<label class="col-sm-3 control-label no-padding-right" for="form-field-1"> 跳转地址 </label>
								<div class="col-sm-9">
									<input type="text" name="column_address" id="column_address"  value="{$column.column_address}"  class="col-xs-10 col-sm-7" />
                                            <span class="help-inline col-xs-12 col-sm-5">
												<span class="middle">正确格式：http:// 开头</span>
											</span>
								</div>
							</div>
							<div class="space-4"></div>


							<div class="form-group">
								<label class="col-sm-3 control-label no-padding-right" for="form-field-1"> 是否开启 </label>
								<div class="col-sm-9" style="padding-top:5px;">
									<input name="column_open" id="column_open" <if condition="$column.column_open eq 1">checked</if> value="1" class="ace ace-switch ace-switch-4 btn-flat" type="checkbox" />
									<span class="lbl">&nbsp;&nbsp;默认关闭</span>
								</div>
							</div>
							<div class="space-4"></div>

							<div class="form-group">
								<label class="col-sm-3 control-label no-padding-right" for="form-field-1"> 排序（从小到大） </label>
								<div class="col-sm-9">
									<input type="text" name="column_order" id="column_order" value="{$column.column_order}" class="col-xs-10 col-sm-1" />
								</div>
							</div>
							<div class="space-4"></div>

							<div class="form-group">
								<label class="col-sm-3 control-label no-padding-right" for="form-field-1"> 单页面内容 </label>
								<div class="col-sm-9">
									<script src="__PUBLIC__/ueditor/ueditor.config.js" type="text/javascript"></script>
									<script src="__PUBLIC__/ueditor/ueditor.all.js" type="text/javascript"></script>
									<textarea name="column_content" rows="100%" style="width:100%" id="myEditor">{$column.column_content}</textarea>
									<script type="text/javascript">
										var editor = new UE.ui.Editor();
										editor.render("myEditor");
									</script>
								</div>
							</div>
							<div class="space-4"></div>
							<div class="form-group">
								<label class="col-sm-3 control-label no-padding-right" for="form-field-1"> SEO标题： </label>
								<div class="col-sm-9">
									<input type="text" id="column_title" name="column_title" value="{$column.column_title}"  placeholder="SEO标题"  class="col-xs-10 col-sm-5" />

								</div>
							</div>

							<div class="space-4"></div>
							<div class="form-group">
								<label class="col-sm-3 control-label no-padding-right" for="form-field-1"> SEO关键字： </label>
								<div class="col-sm-9">
									<input type="text" id="column_key" name="column_key" value="{$column.column_key}"  placeholder="SEO关键字" class="col-xs-10 col-sm-5" />
                                            <span class="help-inline col-xs-12 col-sm-7">
												<span class="middle">每个关键字用英文 , 号隔开</span>
											</span>
								</div>
							</div>
							<div class="space-4"></div>

							<div class="form-group">
								<label class="col-sm-3 control-label no-padding-right" for="form-field-1"> SEO描述： </label>
								<div class="col-sm-9">
									<input type="text" id="column_des" name="column_des"  value="{$column.column_des}" placeholder="SEO描述"  class="col-xs-10 col-sm-10" />
								</div>
							</div>
							<div class="space-4"></div>

							<div class="clearfix form-actions">
								<div class="col-md-offset-3 col-md-9">
									<button class="btn btn-info" type="submit">
										<i class="ace-icon fa fa-check bigger-110"></i>
										保存
									</button>

									&nbsp; &nbsp; &nbsp;
									<button class="btn" type="reset">
										<i class="ace-icon fa fa-undo bigger-110"></i>
										重置
									</button>
								</div>
							</div>
						</form>
					</div>
				</div>
				<div class="hr hr-24"></div>

				<include file='Common:header_nav' />

			</div><!-- /.page-content -->
		</div>
	</div><!-- /.main-content -->

	<include file='Common:footer' />

	<script>
		$(function(){
			$('#address').hide();//默认隐藏
			$('#type2').click(function(){
				$('#address').show();
			});
			$('#type1,#type3,#type4,#type5').click(function(){
				$('#address').hide();
			});
		});

		$(function(){
			$('#runnews_columnedit').ajaxForm({
				beforeSubmit: checkForm, // 此方法主要是提交前执行的方法，根据需要设置
				success: complete, // 这是提交后的方法
				dataType: 'json'
			});

			function checkForm(){
				if( '' == $.trim($('#column_name').val())){
					$('#resone').attr("class", "middle highmsg");//ID为resone 重新class赋值
					$('#resone').html('栏目标题不能为空').show();//id为resone 赋值html值
					$('#column_name').focus();
					return false;
				}
			}
			function complete(data){
				if(data.status==1){
					layer.alert(data.info, {icon: 6}, function(index){
						layer.close(index);
						window.location.href=data.url;
					});
				}else{
					layer.alert(data.info, {icon: 5}, function(index){
						layer.close(index);
						window.location.href="{:U('news_column_list')}";
					});
					return false;
				}
			}

		});
	</script>

</div><!-- /.main-container -->
</body>
</html>
